package com.zuche.data;


public class Result<T> {
    //返回状态码
    private Integer code;
    //放回提示信息
    private String message;
    //返回的数据
    private T data;
    //
    public static Result OK(){
        return new Result(enums.OK.getDataCode(),enums.OK.getDataMassage());
    }
    public static Result ER(){
        return new Result(enums.ER.getDataCode(),enums.ER.getDataMassage());
    }

    public static Result response(enums en){
        return new Result(en.getDataCode(),en.getDataMassage());

    }



    public Result(Integer code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public Result(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Result() {
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return data;
    }

    public Result setData(T data) {
        this.data = data;
        return this;//this表示当前对象
    }
}
